
package TokensDelLenguaje;

import PolacaInversa.Registro;

public abstract class Token_Uint extends Token implements Cloneable, Token_Dato {
    
    protected Long valor;
    
    public Token_Uint(Tokens id){
        super(id);
        valor = null;
    }
          
    @Override
    public Long getLong(){
        return valor;
    }

    public boolean equals(Object o) {
        if(super.equals(o)) {
           if(valor != null) 
              if(valor.equals(((Token)o).getLong())) {
                return true;
              }
            }
         return false;
    }

    @Override
    public String toString() {
        String s = super.toString();
        if(valor != null) {
            return "[ " + s + ' ' + valor.toString() + " ]";
        }
        else {
            return s + " ¡VALOR FUERA DE RANGO!";
        }
    }

    public int hashCode() {
        if(valor != null) {
            return valor.hashCode();
        }
        else {
            return super.hashCode();
        }
    }

    public abstract int getTamano();
    
    @Override
    public Object clone(){
        Token_Uint copia = null;
        
        copia = (Token_Uint)super.clone();
        
        return copia;
    }
    
    public String getNombre(){
        return "_" + this.getCadena();
    }
    
    public abstract String conversion(Registro r);

}